package com.lkd.mapper;

import com.lkd.dto.VmTypeDto;
import com.lkd.entity.VmType;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface VmTypeMapper {
    @Select("select * from tb_vm_type where type_id = #{vmType}")
    VmType findByTypeId(Integer vmType);



    List<VmType> findList(VmTypeDto vmTypeDto);

    @Insert("INSERT INTO tb_vm_type (vm_row, vm_col, name, channel_max_capacity, model, image) " +
            "VALUES (#{vmRow}, #{vmCol}, #{name}, #{channelMaxCapacity}, #{model}, #{image})")
    Boolean save(VmType vmType);

    @Update("UPDATE tb_vm_type SET vm_row = #{vmRow}, vm_col = #{vmCol}, name = #{name}, " +
            "channel_max_capacity = #{channelMaxCapacity}, model = #{model}, image = #{image} " +
            "WHERE type_id = #{typeId}")
    Boolean update(VmType vmType);

    @Delete("DELETE FROM tb_vm_type WHERE type_id = #{id}")
    Boolean deleteById(Integer id);
}
